package cn.edu.scau.cmi.ema.domain;


import java.io.Serializable;

import java.lang.StringBuilder;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.persistence.*;
import javax.xml.bind.annotation.*;
import cn.edu.scau.cmi.ema.domain.*;
import java.util.Set;
import com.alibaba.fastjson.annotation.JSONField;

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllEvent4reports", query = "select myEvent4report from Event4report myEvent4report"),
		@NamedQuery(name = "findEvent4reportByName", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.name = ?1"),
		@NamedQuery(name = "findEvent4reportByNameContaining", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.name like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent4reportByDescription", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.description = ?1"),
		@NamedQuery(name = "findEvent4reportByDescriptionContaining", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.description like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent4reportByCountry", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.country = ?1"),
		@NamedQuery(name = "findEvent4reportByCountryContaining", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.country like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent4reportByProvince", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.province = ?1"),
		@NamedQuery(name = "findEvent4reportByProvinceContaining", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.province like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent4reportByCity", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.city = ?1"),
		@NamedQuery(name = "findEvent4reportByCityContaining", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.city like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent4reportByAudltertypename", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.audltertypename = ?1"),
		@NamedQuery(name = "findEvent4reportByAudltertypenameContaining", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.audltertypename like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent4reportByFoodtypename", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.foodtypename = ?1"),
		@NamedQuery(name = "findEvent4reportByFoodtypenameContaining", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.foodtypename like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent4reportById", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.id = ?1"),
		@NamedQuery(name = "findEvent4reportByPrimaryKey", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.id = ?1 "),
		@NamedQuery(name = "deleteEvent4reportsByIds", query = "delete Event4report where id in (?1)"),
		@NamedQuery(name = "findEvent4reportsByIds", query = "select myEvent4report from Event4report myEvent4report where myEvent4report.id in (?1)"),
		@NamedQuery(name = "findEvent4reportByPhyscialPrimaryKey", query = "select myEvent4report from Event4report myEvent4report where  myEvent4report.name = ?1"),
		@NamedQuery(name = "countEvent4reportsByName", query = "select count(myEvent4report)  from Event4report myEvent4report where myEvent4report.name like concat('%',?1,'%')") })
@Table(catalog = "ema", name = "event4report")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "ema/cn/edu/scau/cmi/ema/domain", name = "Event4report")
@XmlRootElement(namespace = "ema/cn/edu/scau/cmi/ema/domain")

public class Event4report implements Serializable, Comparable<Event4report> {

	private static final long serialVersionUID = 1L;

	@Column(name = "id", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@XmlElement
	Integer id;

	@Column(name = "name")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String name;

	@Column(name = "description")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String description;

	@Column(name = "country")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String country;

	@Column(name = "province")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String province;

	@Column(name = "city")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String city;

	@Column(name = "audltertypename")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String audltertypename;

	@Column(name = "foodtypename")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String foodtypename;

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getId() {
		return this.id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return this.name;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getDescription() {
		return this.description;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getCountry() {
		return this.country;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getProvince() {
		return this.province;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getCity() {
		return this.city;
	}

	public void setAudltertypename(String audltertypename) {
		this.audltertypename = audltertypename;
	}

	public String getAudltertypename() {
		return this.audltertypename;
	}

	public void setFoodtypename(String foodtypename) {
		this.foodtypename = foodtypename;
	}

	public String getFoodtypename() {
		return this.foodtypename;
	}

	public void copy(Event4report that) {

		setId(that.getId());

		setName(that.getName());
		setDescription(that.getDescription());
		setCountry(that.getCountry());
		setProvince(that.getProvince());
		setCity(that.getCity());
		setAudltertypename(that.getAudltertypename());
		setFoodtypename(that.getFoodtypename());

	}

	public Event4report() {

	}

	@Override
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("id=[").append(id).append("] ");

		buffer.append("name=[").append(name).append("] ");
		buffer.append("description=[").append(description).append("] ");
		buffer.append("country=[").append(country).append("] ");
		buffer.append("province=[").append(province).append("] ");
		buffer.append("city=[").append(city).append("] ");
		buffer.append("audltertypename=[").append(audltertypename).append("] ");
		buffer.append("foodtypename=[").append(foodtypename).append("] ");

		return buffer.toString();
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
		return result;
	}

	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Event4report))
			return false;
		Event4report comparedEvent4report = (Event4report) obj;
		if (!CheckPropertyEqual(this.name, comparedEvent4report.name)) {
			return false;
		}
		return true;
	}

	public static <T> boolean CheckPropertyEqual(T originProperty, T comparedProperty) {
		// 基本类型经过参数传递后会自动装箱
		String[] className = originProperty.getClass().getName().split("\\.");
		if (className[0].equals("java") && className[1].equals("math")) {
			return ((Comparable) originProperty).compareTo(comparedProperty) == 0 ? true : false;
		} else {
			return originProperty.equals(comparedProperty);
		}
	}

	@Override
	public int compareTo(Event4report o) {
		if (this.getId() > o.getId()) {
			return 1;
		} else if (this.getId() == o.getId()) {
			return 0;
		} else {
			return -1;
		}

	}
}
